package org.moonlight.jvm.instructions.math.arithmetic.add;

import org.moonlight.jvm.instructions.base.NoOperandsInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.exclusive.OperandStack;

/**
 * LADD: 从 操作数栈 中弹出两个 long变量，求和，然后把结果推入操作数栈。
 *
 * @author Moonlight
 * @createTime 2023/8/16 17:35
 **/
public class LAdd extends NoOperandsInstruction {

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();

        long a = stack.popLong();
        long b = stack.popLong();

        stack.pushLong(a + b);
    }

}
